package n2236;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	static int father[]=new int[1001];
	static int rank[]=new int[1001];
	
	static int comp[][]=new int[1001][2];
	
	static int good[]=new int[1001];
	
	static int N,D,G;
	
	static void init()
	{
		for(int i=0;i<N;i++)
		{
			father[i]=i;
			rank[i]=1;
		}
	}
	
	static int find(int x)
	{
		if(father[x]!=x)father[x]=find(father[x]);
		return father[x];
	}
	
	static void union(int x,int y)
	{
		x=find(x);
		y=find(y);
		if(x==y)return;
		if(rank[x]<rank[y])
		{
			father[x]=y;
			rank[y]+=rank[x];
		}else{
			father[y]=x;
			rank[x]+=rank[y];
		}
	}
	
	
	
	/**
	 * @param args
	 */
	public static void main(String[] args)throws Exception {

		BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer(bf.readLine());
		N=Integer.parseInt(st.nextToken());
		D=Integer.parseInt(st.nextToken());
		for(int i=0;i<N;i++)
		{
			st=new StringTokenizer(bf.readLine());
			comp[i][0]=Integer.parseInt(st.nextToken());
			comp[i][1]=Integer.parseInt(st.nextToken());
		}
		
		init();
		
		String line=null;
		while((line=bf.readLine())!=null)
		{
			st=new StringTokenizer(line);
			String f=st.nextToken();
			if(f.equals("O"))
			{
				int c=Integer.parseInt(st.nextToken());
				good[G++]=c-1;
				for(int i=0;i<G-1;i++)
				{
					if((comp[good[i]][0]-comp[c-1][0])*(comp[good[i]][0]-comp[c-1][0])+(comp[good[i]][1]-comp[c-1][1])*(comp[good[i]][1]-comp[c-1][1])<=D*D)
					{
						union(good[i],c-1);
					}
				}
			}else if(f.equals("S"))
			{
				int t1=Integer.parseInt(st.nextToken());
				int t2=Integer.parseInt(st.nextToken());
				if(find(t1-1)==find(t2-1))
				{
					System.out.println("SUCCESS");
				}else{
					System.out.println("FAIL");
				}
			}
		}
		
		
	}

}
